package com.xin.ruanjian.omsystem.utils;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;

/**
 * popupWindow 弹入弹出动画
 * Created by dalong on 2016/12/22.
 */

public class AnimationUtil {
    //弹入动画时间
    public final static int ANIMATION_IN_TIME = 400;
    //弹出动画时间
    public final static int ANIMATION_OUT_TIME = 300;

    /**
     * 创建弹入动画集合
     */
    public static void createInAnimation(float fromYDelta, View view){
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", fromYDelta, 0);
        animator.setDuration(ANIMATION_IN_TIME);
        animator.start();
    }

    /**
     * 创建退出动画
     */
    public static void createOutAnimation(float fromYDelta, View view){
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationY", 0, fromYDelta);
        animator.setDuration(ANIMATION_OUT_TIME);
        animator.start();
    }
}
